<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Halaman Admnistrator Culture-vid</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
	<link href="<?php echo base_url()?>asset/css/bootstrap.css" rel="stylesheet">
	<link href="<?php echo base_url()?>asset/css/bootstrap-responsive.css" rel="stylesheet">
	<link href="<?php echo base_url()?>asset/css/style.css" rel="stylesheet">
    <link rel="shortcut icon" href="/favicon.ico">
	
</head>
<body>  

	<div class="container-fluid" style="background-color:">  
		    <div class="row-fluid">  
				<div class="col-lg-12" id="header">  
					<a href="<?php echo base_url()?>index.php"><img src="<?php echo base_url()?>asset/img/logo.png" style="width: 300px; height: 120px; align:center; display: inline; margin: 0px 0 50px 20px"/></img></a>
					<h3 style="margin: -79px 0 20px 90px; font-family: Georgia; font-size: 30px"></h3> <br>
					<small style="font-family: Times New Roman; font-size: 17px; margin: -40px 0 0 90px; display: inline; position: absolute"></small>
					<span style="margin-top: -15px; margin-right:10px; font-family: tahoma; font-size:18px;" class="pull-right span3">
					
					<?php
					
						if(!$this->session->userdata('isLogin')) { ?>
					<button class="btn btn-primary" data-toggle="modal" data-target="#modal_login">Login</button>
				| <a href="<?php echo base_url()?>index.php/akun/daftar" class="btn btn-success" role="button">Daftar</a>
					<?php } else { ?> <a href="<?php echo base_url()?>index.php/" class="btn btn-success" role="button"><span class="glyphicon glyphicon-home"></span> Home</a> | <a href="<?php echo base_url()?>index.php/akun/keluar_akun" class="btn btn-danger" role="button"><span class="glyphicon glyphicon-log-out"></span> Keluar</a> <?php } ?>
					</span>
					
				</div>  
			</div> <?php $user = $this->session->userdata('username'); ?>
		<div class="row-fluid" >
			<div class="col-lg-12" id="navbar" >
			<!--span class="pull-left" style="margin-left:5px; color:#ffffff;"> <h3><!?php echo $user; ?> : Administrator</h3> </span-->
				<form class="navbar-form navbar-right" style="margin-top:10px; margin-right:0px; margin-left:1px;" role="search" action="<?php echo base_url()?>index.php/video/cari_video" method="post">
				
					  <div class="form-group ">
						<input type="text" class="form-control" placeholder="cari video disini..." name="cari">
					  </div>
					  <button type="submit" class="btn btn-danger " ><span class="glyphicon glyphicon-search "></span></button>
				</form>
				
				
			</div>  
		</div>
		
	<div class="container-fluid">  
		<div class="row-fluid">  
		<div class="col-lg-2 " style="background-color:white;" id="left-content">  
		 <div class="row-fluid">  
			<?php $user = $this->session->userdata('username'); ?>
			<?php $peran = $this->session->userdata('peran'); ?>
			<?php if($user != NULL):?>
		   <div class="col-lg-12" id="sidebar-widget">
				<ul class="nav nav-list">
				  <li class="nav-header" style=""><strong><?php if($peran == 0 ) { echo $user; ?> : Administrator <?php } else if($peran == 1){ echo $user?> : Administrator Reviewer <?php } else { echo $user; ?> : Reviewer <?php } ?></strong></li>
					<li><a href="<?php echo base_url()?>index.php/admin" class="glyphicon glyphicon-user">  Profilku </a></li>  
					<?php if($peran == 0 || $peran == 1){?><li><a href="<?php echo base_url()?>index.php/admin/list_akun" class="glyphicon glyphicon-wrench">  Master Akun </a></li> <?php } ?>
					<?php if($peran == 2 || $peran == 0){?><li><a href="<?php echo base_url()?>index.php/video/data_video" class="glyphicon glyphicon-wrench"><!--span class="badge pull-right"></span-->  Master Video </a></li> <?php } ?>
					<?php if($peran == 0){?><li><a href="<?php echo base_url()?>index.php/komentar/data" class="glyphicon glyphicon-wrench">  Master Komentar </a></li> <?php } ?>
					</ul>
				<span class="col-lg-1"/>
			</div> <?php endif;?>
		
		  
		 </div>   
		</div>  
	   
			   	   
		<div class="col-lg-10" style="background-color:white" id="right-content">  
		 <div class="main-content row-fluid">
		<!-- konten video -->
		  <div class="col-lg-12 " style="margin-left:0px">
			<div class="col-lg-8">
				<form class="navbar-form navbar-left" style="margin-top:10px; margin-right:0px; margin-left:1px;" role="search" method="post" action="<?php echo base_url();?>index.php/admin/cari_akun">
					
						  <div class="form-group ">
							<input type="text" class="form-control" name="cari" placeholder="cari akun user di sini...">
						  </div>
						  <button type="submit" class="btn btn-danger " ><span class="glyphicon glyphicon-search "></span></button>
						  <?php if($peran == 1 ) { ?> 
						  <a href="<?php echo base_url()?>index.php/admin/cari_reviewer" class="btn btn-primary" role="button"><span class="glyphicon glyphicon-eye-open"></span> Reviewer</a>
						  <?php } else { ?>
						  <a href="<?php echo base_url()?>index.php/admin/cari_kontributor" class="btn btn-success" role="button"><span class="glyphicon glyphicon-pencil"></span> Kontributor</a>
						   <?php }  ?>
				</form>
			</div>
			<div class="col-lg-4">
				<h3>Halaman Master Data Akun</h3>
			</div>
			</div>
			
			
			<div class="col-lg-12 " style="margin-left:0px">
		   <legend style="margin-top:0px"></legend>
			<div class="table-responsive">
				<table class="table table-hover table-bordered">
					<th>No</th>
					<th>ID</th>
					<th>Username</th>
					<th>Nama</th>
					<th>Jenis Kelamin</th>
					<th>Tgl Lahir</th>
					<th>Pendidikan</th>
					<th>Bidang Studi</th>
					<th>Pekerjaan</th>
					<th>Email</th>
					<th>Valid</th>
					<th>Peran</th>
					<th>Hapus</th>
					<th>Validasi</th>
					<?php $no=1; foreach($akun as $row) {?>
						<tr <?php if($row->status_user == 0){ echo 'class="danger"';} else { echo 'class="warning"';}?> >
							<td><?php echo $no?></td>
							<td><?php echo $row->id_user ?></td>
							<td><?php echo $row->username ?></td>
							<td><?php echo $row->nama_lengkap ?></td>
							<td><?php if($row->jk == 1) { echo 'Laki - laki'; } else { echo 'Perempuan';} ?></td>
							<td><?php echo $row->tgl_lahir ?></td>
							<td><?php echo $row->pendidikan ?></td>
							<td><?php echo $row->bidang_studi ?></td>
							<td><?php echo $row->pekerjaan ?></td>
							<td><?php echo $row->email ?></td>
							<td><?php if($row->status_user == 1){ echo 'Ya';} else { echo 'Tidak';} ?></td>
							<td><?php if($row->id_peran == 0){echo 'Admin Sistem';} elseif($row->id_peran == 1) {echo 'Admin Reviewer';} elseif($row->id_peran == 2) {echo 'Reviewer';} else {echo 'Kontributor';}?></td>
							<td><center><a href="<?php echo base_url()?>index.php/admin/hapus_akun/<?php echo $row->id_user; ?>" onclick="return confirmDel()"><span class="glyphicon glyphicon-trash"></span></a></center></td>
							<td><center><a href="<?php echo base_url()?>index.php/admin/validasi_akun/<?php echo $row->id_user; ?>"><span class="glyphicon glyphicon-retweet"></span></a></center></td>
						</tr>
						<script type="text/javascript">
							function confirmDel(){
							return confirm("Apakah Anda yakin untuk menghapus akun ini?");
							}
						</script>
						
					<?php $no++; } ?>
			
				</table>
			</div>
				
	  
		  </div>  
		  <!-- end -->
		 </div>
		</div>  
	  
	   </div>  
	  
	  
	   <!--S : Footer-->  
	  
	   <div class="row-fluid">  
			<div class="col-lg-12" id="footer"> <p class = "footer-text"> @ Copyright 2014 </p> 
			</div>  
	   </div>  
	  
	   <!--E : Footer-->  
	  
	  </div>
	</div>
				
	
	
    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
	
    <script src="<?php echo base_url()?>asset/js/jquery.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-transition.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-alert.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-modal.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-dropdown.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-scrollspy.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-tab.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-tooltip.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-popover.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-button.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-collapse.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-carousel.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-typeahead.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-typeahead.js"></script>
    <script src="<?php echo base_url()?>asset/js/bootstrap-typeahead.js"></script>
	<script type="text/javascript" src="aset/fancybox/jquery.fancybox.js"></script>
	<script type="text/javascript" src="aset/fancybox/jquery.mousewheel.js"></script>
	<link rel="stylesheet" type="text/css" href="aset/fancybox/jquery.fancybox.css" media="screen" />
	<script type="text/javascript">
	$('#modal1').click(function () {
		$('#modal1').modal();
	});
	</script>
	
	<script type="text/javascript">
	$(document).ready(function() {
		$(".fancybox").fancybox();
		$('#container').tooltip({
			selector: "a[rel=tooltip]"
		});
	});
	 
	$('.carousel').carousel({
		interval: 3000
	});
	
	$(function () {
		$('#myTab a:first').tab('show');
	});
	
	</script>
	 <script type="text/javascript">
	/*$('#modal_login').click(function () {
		$('#modal_login').modal();
	});*/
	</script> 
	
	<script type="text/javascript">
	$(document).ready(function(){
    //Listen for the form submit
    $('#modal_daftar').submit(registerUser);
});
 
//The function that handles the process
	function registerUser(event)
	{
		//Stop the form from submitting
		event.preventDefault();
	 
		//Collect our form data.
		var form_data = {
			username : $("[name='namaakun']").val(),
			// password1 : $("[name='password1']").val(),
			// password2 : $("[name='password2']").val(),
			// email : $("[name='email']").val(),
			// full_name : $("[name='full_name']").val()
		};
	 
		//Begin the ajax call
		$.ajax({
				url: "akun/daftar_akun",
				type: "POST",     
				data: form_data,
				dataType: "json",
				cache: false,
				  
				success: function (json) {             
					if (json.error==1)
					{
						//Show the user the errors.
						$('#modal_daftar').show();
					   $('#registerModalerror').html(json.message).show();
					   print json.massage;
					} else {
						//Hide our form
						$('#modal_daftar').slideUp();
						//Show the success message
						$('#registerModalerror').html(json.message).show();
					}             
				}
			});
	}
	
	</script>
</body>
</html>